<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Tiny FTP: cmd_server.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">Tiny FTP
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">cmd_server.c File Reference</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;stdio.h&gt;</code><br />
<code>#include &lt;string.h&gt;</code><br />
<code>#include &lt;errno.h&gt;</code><br />
<code>#include &lt;stdlib.h&gt;</code><br />
<code>#include &lt;unistd.h&gt;</code><br />
<code>#include &lt;sys/socket.h&gt;</code><br />
<code>#include &lt;sys/types.h&gt;</code><br />
<code>#include &lt;sys/stat.h&gt;</code><br />
<code>#include &lt;netinet/in.h&gt;</code><br />
<code>#include &lt;arpa/inet.h&gt;</code><br />
<code>#include &lt;dirent.h&gt;</code><br />
<code>#include &lt;time.h&gt;</code><br />
<code>#include &lt;fcntl.h&gt;</code><br />
<code>#include &quot;ftp_server.h&quot;</code><br />
<code>#include &quot;cmd_server.h&quot;</code><br />
<code>#include &quot;config.h&quot;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for cmd_server.c:</div>
<div class="dyncontent">
<div class="center"><img src="cmd__server_8c__incl.png" border="0" usemap="#acmd__server_8c" alt=""/></div>
<map name="acmd__server_8c" id="acmd__server_8c">
<area shape="rect" title=" " alt="" coords="539,5,649,32"/>
<area shape="rect" title=" " alt="" coords="94,80,161,107"/>
<area shape="rect" title=" " alt="" coords="185,80,256,107"/>
<area shape="rect" title=" " alt="" coords="5,155,73,181"/>
<area shape="rect" title=" " alt="" coords="97,155,168,181"/>
<area shape="rect" title=" " alt="" coords="193,155,267,181"/>
<area shape="rect" title=" " alt="" coords="292,155,395,181"/>
<area shape="rect" title=" " alt="" coords="419,155,515,181"/>
<area shape="rect" title=" " alt="" coords="539,155,625,181"/>
<area shape="rect" title=" " alt="" coords="649,155,745,181"/>
<area shape="rect" title=" " alt="" coords="769,155,861,181"/>
<area shape="rect" title=" " alt="" coords="886,155,958,181"/>
<area shape="rect" title=" " alt="" coords="1025,80,1089,107"/>
<area shape="rect" title=" " alt="" coords="983,155,1045,181"/>
<area shape="rect" href="ftp__server_8h_source.html" title=" " alt="" coords="1069,155,1169,181"/>
<area shape="rect" href="cmd__server_8h_source.html" title=" " alt="" coords="585,80,696,107"/>
<area shape="rect" href="config_8h_source.html" title=" " alt="" coords="1193,155,1267,181"/>
</map>
</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a4885d7333efacbab7886c841527a5c3f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#a4885d7333efacbab7886c841527a5c3f">set_file_dir</a> (char *src, char *file)</td></tr>
<tr class="memdesc:a4885d7333efacbab7886c841527a5c3f"><td class="mdescLeft">&#160;</td><td class="mdescRight">拼接当前工作目录和给出的参数，得到完整路径。  <a href="cmd__server_8c.html#a4885d7333efacbab7886c841527a5c3f">More...</a><br /></td></tr>
<tr class="separator:a4885d7333efacbab7886c841527a5c3f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a68ed484e70fa77e339d9288d943ab4e6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#a68ed484e70fa77e339d9288d943ab4e6">set_cmd_arg</a> (<a class="el" href="structMsg.html">Msg</a> *msg, char *cmd_arg, int bit)</td></tr>
<tr class="memdesc:a68ed484e70fa77e339d9288d943ab4e6"><td class="mdescLeft">&#160;</td><td class="mdescRight">从客户端给出的信息中提取规范化的参数，供之后的具体操作使用。  <a href="cmd__server_8c.html#a68ed484e70fa77e339d9288d943ab4e6">More...</a><br /></td></tr>
<tr class="separator:a68ed484e70fa77e339d9288d943ab4e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a791b072f3c807a07d8f31f79234df324"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#a791b072f3c807a07d8f31f79234df324">server_list</a> (int client_sock, <a class="el" href="structMsg.html">Msg</a> *msg)</td></tr>
<tr class="memdesc:a791b072f3c807a07d8f31f79234df324"><td class="mdescLeft">&#160;</td><td class="mdescRight">打印当前工作目录。  <a href="cmd__server_8c.html#a791b072f3c807a07d8f31f79234df324">More...</a><br /></td></tr>
<tr class="separator:a791b072f3c807a07d8f31f79234df324"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a85d6867e8cd03abe695768d9b067d57d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#a85d6867e8cd03abe695768d9b067d57d">server_put</a> (int client_sock, <a class="el" href="structMsg.html">Msg</a> *msg)</td></tr>
<tr class="memdesc:a85d6867e8cd03abe695768d9b067d57d"><td class="mdescLeft">&#160;</td><td class="mdescRight">向服务端发送文件，可选择ASCII和Binary两种模式。若文件不存在，将会报错。  <a href="cmd__server_8c.html#a85d6867e8cd03abe695768d9b067d57d">More...</a><br /></td></tr>
<tr class="separator:a85d6867e8cd03abe695768d9b067d57d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa50384f65cd75709e683b2c7f08581c1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#aa50384f65cd75709e683b2c7f08581c1">server_get</a> (int client_sock, <a class="el" href="structMsg.html">Msg</a> *msg)</td></tr>
<tr class="memdesc:aa50384f65cd75709e683b2c7f08581c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">从服务端获取文件，可选择ASCII和Binary两种模式。若文件不存在，将会报错。  <a href="cmd__server_8c.html#aa50384f65cd75709e683b2c7f08581c1">More...</a><br /></td></tr>
<tr class="separator:aa50384f65cd75709e683b2c7f08581c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a338cb5462d42666ddab20076f7bd982f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#a338cb5462d42666ddab20076f7bd982f">server_mkd</a> (int client_sock, <a class="el" href="structMsg.html">Msg</a> *msg)</td></tr>
<tr class="memdesc:a338cb5462d42666ddab20076f7bd982f"><td class="mdescLeft">&#160;</td><td class="mdescRight">根据客户端给出的参数，创建相应目录。若目录已存在，将会报错。  <a href="cmd__server_8c.html#a338cb5462d42666ddab20076f7bd982f">More...</a><br /></td></tr>
<tr class="separator:a338cb5462d42666ddab20076f7bd982f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a37c028d5fa7f16c48ecfb86321d4c846"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#a37c028d5fa7f16c48ecfb86321d4c846">server_rmd</a> (int client_sock, <a class="el" href="structMsg.html">Msg</a> *msg)</td></tr>
<tr class="memdesc:a37c028d5fa7f16c48ecfb86321d4c846"><td class="mdescLeft">&#160;</td><td class="mdescRight">根据客户端给出的参数，删除相应目录。若目录不存在，将会报错。  <a href="cmd__server_8c.html#a37c028d5fa7f16c48ecfb86321d4c846">More...</a><br /></td></tr>
<tr class="separator:a37c028d5fa7f16c48ecfb86321d4c846"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acde9e10e0cad1c21935492f0a6d4045d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#acde9e10e0cad1c21935492f0a6d4045d">server_del</a> (int client_sock, <a class="el" href="structMsg.html">Msg</a> *msg)</td></tr>
<tr class="memdesc:acde9e10e0cad1c21935492f0a6d4045d"><td class="mdescLeft">&#160;</td><td class="mdescRight">根据客户端给出的参数，删除相应文件。若文件不存在，将会报错。  <a href="cmd__server_8c.html#acde9e10e0cad1c21935492f0a6d4045d">More...</a><br /></td></tr>
<tr class="separator:acde9e10e0cad1c21935492f0a6d4045d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a64932a67c58d957e2482e0436b7c203c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#a64932a67c58d957e2482e0436b7c203c">server_cwd</a> (int client_sock, <a class="el" href="structMsg.html">Msg</a> *msg)</td></tr>
<tr class="memdesc:a64932a67c58d957e2482e0436b7c203c"><td class="mdescLeft">&#160;</td><td class="mdescRight">根据客户端给出的参数，改变当前工作目录。  <a href="cmd__server_8c.html#a64932a67c58d957e2482e0436b7c203c">More...</a><br /></td></tr>
<tr class="separator:a64932a67c58d957e2482e0436b7c203c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3430c69a06c184495cd28c57f4fe0f7e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#a3430c69a06c184495cd28c57f4fe0f7e">server_pwd</a> (int client_sock, <a class="el" href="structMsg.html">Msg</a> *msg)</td></tr>
<tr class="memdesc:a3430c69a06c184495cd28c57f4fe0f7e"><td class="mdescLeft">&#160;</td><td class="mdescRight">向客户端发送目前所在的工作目录。  <a href="cmd__server_8c.html#a3430c69a06c184495cd28c57f4fe0f7e">More...</a><br /></td></tr>
<tr class="separator:a3430c69a06c184495cd28c57f4fe0f7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9020d28c81a4a7ab08d2acfb369844c7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#a9020d28c81a4a7ab08d2acfb369844c7">handle_port</a> (int client_sock, <a class="el" href="structMsg.html">Msg</a> *msg)</td></tr>
<tr class="memdesc:a9020d28c81a4a7ab08d2acfb369844c7"><td class="mdescLeft">&#160;</td><td class="mdescRight">处理PORT连接的请求。扫描客户端发送的地址信息并连接，生成传递数据的套接字。  <a href="cmd__server_8c.html#a9020d28c81a4a7ab08d2acfb369844c7">More...</a><br /></td></tr>
<tr class="separator:a9020d28c81a4a7ab08d2acfb369844c7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a122d023237866867fcdf8ee05bf2c25c"><td class="memItemLeft" align="right" valign="top">struct sockaddr_in&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#a122d023237866867fcdf8ee05bf2c25c">create_data_sock</a> (int *sock)</td></tr>
<tr class="memdesc:a122d023237866867fcdf8ee05bf2c25c"><td class="mdescLeft">&#160;</td><td class="mdescRight">在创建PASV连接时使用，生成传递数据所需要的套接字并完成绑定和监听。  <a href="cmd__server_8c.html#a122d023237866867fcdf8ee05bf2c25c">More...</a><br /></td></tr>
<tr class="separator:a122d023237866867fcdf8ee05bf2c25c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7ed6e7fa09e32bb518a19a70f5f5565"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cmd__server_8c.html#ac7ed6e7fa09e32bb518a19a70f5f5565">handle_pasv</a> (int client_sock, <a class="el" href="structMsg.html">Msg</a> *msg)</td></tr>
<tr class="memdesc:ac7ed6e7fa09e32bb518a19a70f5f5565"><td class="mdescLeft">&#160;</td><td class="mdescRight">处理PASV连接的请求。连接成功后，将向客户端发送相应的地址信息，并生成传递数据的套接字。  <a href="cmd__server_8c.html#ac7ed6e7fa09e32bb518a19a70f5f5565">More...</a><br /></td></tr>
<tr class="separator:ac7ed6e7fa09e32bb518a19a70f5f5565"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >Implementation of the commands in the ftp server.</p>
<dl class="section author"><dt>Author</dt><dd>wgy, sc </dd></dl>
<dl class="section version"><dt>Version</dt><dd>V1.0 </dd></dl>
<dl class="section date"><dt>Date</dt><dd>2022-11-19 </dd></dl>
<dl class="section copyright"><dt>Copyright</dt><dd>GNU Public License V3.0 </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a122d023237866867fcdf8ee05bf2c25c" name="a122d023237866867fcdf8ee05bf2c25c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a122d023237866867fcdf8ee05bf2c25c">&#9670;&nbsp;</a></span>create_data_sock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct sockaddr_in create_data_sock </td>
          <td>(</td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>sock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>在创建PASV连接时使用，生成传递数据所需要的套接字并完成绑定和监听。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sock</td><td>将要更改的套接字变量的指针。无需初始化。 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>配置好的用户sockaddr_in信息。 </dd></dl>

</div>
</div>
<a id="ac7ed6e7fa09e32bb518a19a70f5f5565" name="ac7ed6e7fa09e32bb518a19a70f5f5565"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac7ed6e7fa09e32bb518a19a70f5f5565">&#9670;&nbsp;</a></span>handle_pasv()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void handle_pasv </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>client_sock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structMsg.html">Msg</a> *&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>处理PASV连接的请求。连接成功后，将向客户端发送相应的地址信息，并生成传递数据的套接字。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">client_sock</td><td>连接客户端的套接字描述符。 </td></tr>
    <tr><td class="paramname">msg</td><td>服务端配置参数的指针。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a9020d28c81a4a7ab08d2acfb369844c7" name="a9020d28c81a4a7ab08d2acfb369844c7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9020d28c81a4a7ab08d2acfb369844c7">&#9670;&nbsp;</a></span>handle_port()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void handle_port </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>client_sock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structMsg.html">Msg</a> *&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>处理PORT连接的请求。扫描客户端发送的地址信息并连接，生成传递数据的套接字。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">client_sock</td><td>连接客户端的套接字描述符。 </td></tr>
    <tr><td class="paramname">msg</td><td>服务端配置参数的指针。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a64932a67c58d957e2482e0436b7c203c" name="a64932a67c58d957e2482e0436b7c203c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a64932a67c58d957e2482e0436b7c203c">&#9670;&nbsp;</a></span>server_cwd()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void server_cwd </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>client_sock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structMsg.html">Msg</a> *&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>根据客户端给出的参数，改变当前工作目录。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">client_sock</td><td>连接客户端的套接字描述符。 </td></tr>
    <tr><td class="paramname">msg</td><td>服务端配置参数的指针。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="acde9e10e0cad1c21935492f0a6d4045d" name="acde9e10e0cad1c21935492f0a6d4045d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acde9e10e0cad1c21935492f0a6d4045d">&#9670;&nbsp;</a></span>server_del()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void server_del </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>client_sock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structMsg.html">Msg</a> *&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>根据客户端给出的参数，删除相应文件。若文件不存在，将会报错。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">client_sock</td><td>连接客户端的套接字描述符。 </td></tr>
    <tr><td class="paramname">msg</td><td>服务端配置参数的指针。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aa50384f65cd75709e683b2c7f08581c1" name="aa50384f65cd75709e683b2c7f08581c1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa50384f65cd75709e683b2c7f08581c1">&#9670;&nbsp;</a></span>server_get()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void server_get </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>client_sock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structMsg.html">Msg</a> *&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>从服务端获取文件，可选择ASCII和Binary两种模式。若文件不存在，将会报错。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">client_sock</td><td>连接客户端的套接字描述符。 </td></tr>
    <tr><td class="paramname">msg</td><td>服务端配置参数的指针。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a791b072f3c807a07d8f31f79234df324" name="a791b072f3c807a07d8f31f79234df324"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a791b072f3c807a07d8f31f79234df324">&#9670;&nbsp;</a></span>server_list()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void server_list </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>client_sock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structMsg.html">Msg</a> *&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>打印当前工作目录。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">client_sock</td><td>连接客户端的套接字描述符。 </td></tr>
    <tr><td class="paramname">msg</td><td>服务端配置参数的指针。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a338cb5462d42666ddab20076f7bd982f" name="a338cb5462d42666ddab20076f7bd982f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a338cb5462d42666ddab20076f7bd982f">&#9670;&nbsp;</a></span>server_mkd()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void server_mkd </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>client_sock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structMsg.html">Msg</a> *&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>根据客户端给出的参数，创建相应目录。若目录已存在，将会报错。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">client_sock</td><td>连接客户端的套接字描述符。 </td></tr>
    <tr><td class="paramname">msg</td><td>服务端配置参数的指针。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a85d6867e8cd03abe695768d9b067d57d" name="a85d6867e8cd03abe695768d9b067d57d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a85d6867e8cd03abe695768d9b067d57d">&#9670;&nbsp;</a></span>server_put()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void server_put </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>client_sock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structMsg.html">Msg</a> *&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>向服务端发送文件，可选择ASCII和Binary两种模式。若文件不存在，将会报错。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">client_sock</td><td>连接客户端的套接字描述符。 </td></tr>
    <tr><td class="paramname">msg</td><td>服务端配置参数的指针。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a3430c69a06c184495cd28c57f4fe0f7e" name="a3430c69a06c184495cd28c57f4fe0f7e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3430c69a06c184495cd28c57f4fe0f7e">&#9670;&nbsp;</a></span>server_pwd()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void server_pwd </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>client_sock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structMsg.html">Msg</a> *&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>向客户端发送目前所在的工作目录。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">client_sock</td><td>连接客户端的套接字描述符。 </td></tr>
    <tr><td class="paramname">msg</td><td>服务端配置参数的指针。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a37c028d5fa7f16c48ecfb86321d4c846" name="a37c028d5fa7f16c48ecfb86321d4c846"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a37c028d5fa7f16c48ecfb86321d4c846">&#9670;&nbsp;</a></span>server_rmd()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void server_rmd </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>client_sock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structMsg.html">Msg</a> *&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>根据客户端给出的参数，删除相应目录。若目录不存在，将会报错。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">client_sock</td><td>连接客户端的套接字描述符。 </td></tr>
    <tr><td class="paramname">msg</td><td>服务端配置参数的指针。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a68ed484e70fa77e339d9288d943ab4e6" name="a68ed484e70fa77e339d9288d943ab4e6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a68ed484e70fa77e339d9288d943ab4e6">&#9670;&nbsp;</a></span>set_cmd_arg()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void set_cmd_arg </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structMsg.html">Msg</a> *&#160;</td>
          <td class="paramname"><em>msg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>cmd_arg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>bit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>从客户端给出的信息中提取规范化的参数，供之后的具体操作使用。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">msg</td><td>服务端配置参数的指针，此处使用接收到的客户端消息数据。 </td></tr>
    <tr><td class="paramname">cmd_arg</td><td>存放规范化参数的位置。 </td></tr>
    <tr><td class="paramname">bit</td><td>命令的位数。参数将会从命令之后开始读取。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a4885d7333efacbab7886c841527a5c3f" name="a4885d7333efacbab7886c841527a5c3f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4885d7333efacbab7886c841527a5c3f">&#9670;&nbsp;</a></span>set_file_dir()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void set_file_dir </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>file</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>拼接当前工作目录和给出的参数，得到完整路径。 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>将要存放得到的路径字符串的位置。 </td></tr>
    <tr><td class="paramname">file</td><td>具体文件名的字符串指针。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
